var req;
var url = "http://localhost:8888/CPAnaylizer/frame";
function Display() {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();   //创建XMLHttpRequest对象    
	} else {
		if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	if (req) {
		req.open("POST", url, true); //建立请求
		req.setRequestHeader("Content-Type", "text/xml");
		req.onreadystatechange = callback; //指定回调函数
		req.send(null);
	}
}
function callback() {
	if (req.readyState == 3) {
		sendMessage();
	}
	if (req.readyState == 4) {
		if (req.status == 200) {
			//alert("数据正在传送中，请点击<确定>按钮");
			alert("数据传输完毕");
			//updateByXML(req.responseXML.documentElement);	
			showReuslts(req.responseXML.documentElement,"http://localhost:8888/CPAnaylizer/frame","10.1.55.187:8080");
			
		}
	}
}
function sendMessage() {
	var content = document.getElementById("code");
	var content1 = document.getElementById("hade");
	content.style.display = "";
	content1.style.display = "none";
	content.innerHTML = "LOADING....";
}
function showReuslts(xmlDoc,baseurl,km) {
    var ds = new datasource(xmlDoc, "item");
	var content = document.getElementById("hade");
	var content1 = document.getElementById("code");
	content1.style.display = "none";
	content.style.display = "";
	var s ='' ;
	for(var i =0;i<ds.getCount();i++){
	   var categoryID = ds.getAttribute(i, "categoryID");
	   var categoryName= ds.getAttribute(i, "categoryName")
	   var resultsCount= ds.getAttribute(i, "resultsCount")
	   var url = baseurl+"?dsdList="+km+"@"+categoryID;
	   s= s+"<a href=\""+url+"\">"+categoryName+"("+resultsCount+")"+"</a>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;";
	}
	content.innerHTML = s;
}



